from ..helpers import article
from ._helpers import QuadrilateralScheme, concat, pmx

citation = article(
    authors=["Johannes W. Wissmann", "Thomas Becker"],
    title="Partially Symmetric Cubature Formulas for Even Degrees of Exactness",
    journal="SIAM J. Numer. Anal.",
    volume="23",
    number="3",
    pages="676–685",
    url="https://doi.org/10.1137/0723043",
)


def wissmann_becker_4_1():
    weights, points = concat(
        ([8.0 / 7.0], [[0, 0]]),
        ([0.439560439560440], [[0, 0.966091783079296]]),
        pmx(
            [0.566072207007532, 0.851914653304601, 0.455603727836193],
            [0.642719001783677, 0.630912788976754, -0.731629951573135],
        ),
    )
    return QuadrilateralScheme("Wissmann-Becker 4-1", weights, points, 4, citation)


def wissmann_becker_4_2():
    weights, points = concat(
        ([1.286412084888852], [[0, -0.356822089773090]]),
        ([0.491365692888926], [[0, 0.934172358962716]]),
        pmx(
            [0.761883709085613, 0.774596669241483, 0.390885162530071],
            [0.349227402025498, 0.774596669241483, -0.852765377881771],
        ),
    )
    return QuadrilateralScheme("Wissmann-Becker 4-2", weights, points, 4, citation)


def wissmann_becker_6_1():
    weights, points = concat(
        ([0.455343245714174], [[0, 0.836405633697626]]),
        ([0.827395973202966], [[0, -0.357460165391307]]),
        pmx(
            [0.144000884599645, 0.888764014654765, 0.872101531193131],
            [0.668259104262665, 0.604857639464685, 0.305985162155427],
            [0.225474004890679, 0.955447506641064, -0.410270899466658],
            [0.320896396788441, 0.565459993438754, -0.872869311156879],
        ),
    )
    return QuadrilateralScheme("Wissmann-Becker 6-1", weights, points, 6, citation)


def wissmann_becker_6_2():
    weights, points = concat(
        ([0.392750590964348], [[0, 0.869833375250059]]),
        ([0.754762881242610], [[0, -0.479406351612111]]),
        pmx(
            [0.206166050588279, 0.863742826346154, 0.802837516207657],
            [0.689992138489864, 0.518690521392582, 0.262143665508058],
            [0.260517488732317, 0.933972544972849, -0.363096583148066],
            [0.269567586086061, 0.608977536016356, -0.896608632762453],
        ),
    )
    return QuadrilateralScheme("Wissmann-Becker 6-2", weights, points, 6, citation)


def wissmann_becker_8_1():
    weights, points = concat(
        ([0.055364705621440], [[0, 0]]),
        ([0.404389368726076], [[0, 0.757629177660505]]),
        ([0.533546604952635], [[0, -0.236871842255702]]),
        ([0.117054188786739], [[0, -0.989717929044527]]),
        pmx(
            [0.125614417613747, 0.639091304900370, 0.950520955645667],
            [0.136544584733588, 0.937069076924990, 0.663882736885633],
            [0.483408479211257, 0.537083530541494, 0.304210681724104],
            [0.252528506429544, 0.887188506449625, -0.236496718536120],
            [0.361262323882172, 0.494698820670197, -0.698953476086564],
            [0.085464254086247, 0.897495818279768, -0.900390774211580],
        ),
    )
    return QuadrilateralScheme("Wissmann-Becker 8-1", weights, points, 8, citation)


def wissmann_becker_8_2():
    weights, points = concat(
        ([0.450276776305590], [[0, 0.659560131960342]]),
        ([0.166570426777813], [[0, -0.949142923043125]]),
        pmx(
            [0.098869459933431, 0.952509466071562, 0.765051819557684],
            [0.153696747140812, 0.532327454074206, 0.936975981088416],
            [0.396686976072903, 0.684736297951735, 0.333656717735747],
            [0.352014367945695, 0.233143240801405, -0.079583272377397],
            [0.189589054577798, 0.927683319306117, -0.272240080612534],
            [0.375101001147587, 0.453120687403749, -0.613735353398028],
            [0.125618791640072, 0.837503640422812, -0.888477650535971],
        ),
    )
    return QuadrilateralScheme("Wissmann-Becker 8-2", weights, points, 8, citation)
